﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StatePattern
{
    /// <summary>
    /// 抽象的状态角色：接口或者抽象类，负责对象状态定义，并且封装环境角色以实现状态切换
    /// </summary>
    abstract class State
    {
        /// <summary>
        /// 定义一个上下文角色，提供子类访问
        /// </summary>
        private Context context;
        /// <summary>
        /// 设置环境变量
        /// </summary>
        public Context Context {
            set
            {
                this.context = value;
            }
            protected get
            {
                return this.context;
            }
        }
        //行为1
        public abstract void handle1();
        //行为2
        public abstract void handle2();
    }
}
